<?php
namespace app\index\controller;

class Download extends Base
{
//前置方法
    protected $beforeActionList = [
        // 'right_hot',
        'right' => ['only' => 'index,detailed'],
        // 'info_hot' => ['only' => 'detailed'],
    ];


    //相关
    public function info_hot(){
        // 最新帖子
        $list = model('Download')->where($this->datas)->where('cid','neq','0')->order('title deSC')->limit(5)->select();
        $this->assign([
            'listinfo'=> $list,
        ]);
    }


    //右边最热，最新
    public function right_hot(){

        // 最新帖子
        $list = db('Download')
            ->alias('a')
            ->join('__NAV__ c', 'c.id= a.cid AND c.lang= a.lang AND c.status = a.status')
            ->field('a.id,a.cid,a.title,c.model,a.create_time')
            ->where('a.status', '1')
            ->order('a.id DESC,a.update_time DESC')
            ->limit(10)
            ->select();
        //最新回复帖子
        $hot = db('Download')
            ->alias('a')
            ->join('__NAV__ c', 'c.id= a.cid AND c.lang= a.lang AND c.status = a.status')
            ->field('a.id,a.cid,a.title,c.model,a.create_time')
            ->where('a.status', '1')
            ->order('a.update_time DESC,a.id DESC')
            ->limit(10)
            ->select();


        $this->assign([
            'hotten'=> $hot,
            'listten'=> $list,
        ]);
    }
}
